package com.itheima.controller;

import com.itheima.common.R;

import com.itheima.pojo.vo.dishVo.DishByCategoryIdVo;
import com.itheima.pojo.vo.dishVo.GetDishByIdVo;
import com.itheima.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
public class DishController {
    @Autowired
    private DishService service;

    @GetMapping("/dish/list")
    public R<Object> selectAllByCategoryId(String categoryId,Integer status){
        List<DishByCategoryIdVo> dish = service.selectAllByCategoryId(categoryId, status);
        return R.success(dish);
    }
    @GetMapping("/setmeal/dish/")
    public R selectByDishId(String id){
        GetDishByIdVo dish = service.selectById(id);
        return R.success(dish);
    }


}
